var name_1 = document.getElementById("name");
var pwd = document.getElementById("pwd");
var code = document.getElementById("code");
var nametip = document.getElementById("nametip");
var nametip1 = document.getElementById("nametip1");
var nametip2 = document.getElementById("nametip2");
var pwdtip = document.getElementById("pwdtip");
var pwdtip1 = document.getElementById("pwdtip1");
var codetip = document.getElementById("codetip");
var reg_name = /^([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z0-9]){6,16}$/;
var reg_email = /^[a-zA-Z\d_]+(\.[a-zA-Z\d_]+)*@([\da-zA-Z](-[\da-zA-Z])?)+(\.{1,2}[a-zA-Z]+)+$/;
var reg_pwd = /^[a-zA-Z0-9_]{1}\w{5,17}$/;

name_1.onblur = function(){
	var name_value = name_1.value;
	if (name_value.indexOf(" ") >=0) {
		nametip2.style.display = "block";
		nametip.style.display = "none";
   		name_value = name_value.replace(/\s/g, "");
   		return false;
	}else{
		nametip2.style.display = "none";
	}
	
	if (name_value.trim() == "" || !reg_name.test(name_value) && !reg_email.test(name_value)) {
		nametip.style.display = "block";
		return false;
	}else{
		nametip.style.display = "none";
	}
	
}

pwd.onblur = function(){
 	var pwd_value = pwd.value;
	if (pwd_value.trim() == "" || !reg_pwd.test(pwd_value)) {
		pwdtip1.style.display = "none";
		pwdtip.style.display = "block";
		return false;
	}else{
		pwdtip.style.display = "none";
	}
}